package org.zhou.controller;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.zhou.dao.EmployeeDao;
import org.zhou.pojo.Employee;

import java.util.Collection;

//员工管理
@Controller
public class EmployController {
//    查询所有的员工
    @Autowired
    EmployeeDao employeeDao;
    @RequestMapping("/emps")
    public String elist(Model model){
        Collection<Employee> employees = employeeDao.queryA();
        model.addAttribute("aemployee",employees);
        return "emp/list";

    }
    @GetMapping("/emp")
    public String toAddpage(){
        return "emp/add";
    }

}
